<template>
  <div class="new">
    <search-header></search-header>
    <swiper :imgList="imgList"></swiper>

    <div class="content-list" @click="train()">
      <div class="left">
        <img :src="item.img"/>
      </div>
      <div class="right">
        <p class="right-title">{{item.title}}</p>
        <p class="right-desc">{{item.content}}</p>
        <p class="right-bottom">
          <span class="right-btn">播放</span>
        </p>
      </div>
    </div>

  </div>
</template>

<script>
  import searchHeader from '@/components/header/searchHeader'
  import Swiper from '@/components/swiper/Swiper'
  import axios from 'axios'

  export default {
    name: "new",
    data() {
      return {
        imgList: [],
        active: 1,
        trainList: [],
      };
    },
    components: {
      searchHeader,
      Swiper,
    },
    methods: {
      train() {
        this.$router.push('/videoDetail');
      },
      getHomeInfo() {
        axios.get('static/all.json')
          .then(this.getHomeInfoSucc)
      },
      getHomeInfoSucc(res) {
        if (res.data) {
          this.imgList = res.data.imgList
          this.trainList = res.data.trainList
        }
      },
    },
    mounted() {
      this.getHomeInfo()
    },

  }
</script>

<style scoped lang="less">

  .new {
    font-size: 14px;
    .content-list {
      padding: 18px 10px 18px 10px;
      display: flex;
      .left {
        width: 130px;
        height: 90px;
        position: relative;
        overflow: hidden;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .right {
        text-align: left;
        padding: 6px 0 6px 8px;
        flex: 1;
        .right-title {
          font-weight: bold;
          padding-bottom: 4px;
        }
        .right-desc {
          font-size: 12px;
          color: #666;
        }
        .right-bottom {
          position: absolute;
          bottom: 18px;
          right: 10px;
          .right-btn {
            background: #a6d640;
            border-radius: 3px;
            color: #fff;
            text-align: center;
            font-size: 12px;
            font-weight: 500;
            margin-top: 8px;
            padding: 2px 12px 2px 12px;
          }
        }
      }
    }

  }
</style>
